Routing
In the late 1980s, a computer scientist working at , Tim Berners-Lee, had a novel idea: Hypertext, but on the internet.
“Hypertext” is a document format that includes “hyperlinks”, shortcuts that you can use to jump from one document to another. There have been many implementations and variations, but the core idea is that each individual document can contain links to other documents, allowing users to jump around as they wish.
Hypertext has been around for a long time. It goes back to an academic paper published in the 1940s, and would become a core part of Doug Engelbart's 1968 talk, commonly known as the “Mother of All Demos” (opens in new tab)!
When the internet came along in the early 80s, it wasn't immediately obvious that Hypertext was the ideal interface for sharing information online. Instead, people communicated using:
- FTP (File Transfer Protocol), to upload/download files from a particular machine.
- SMTP (Simple Mail Transfer Protocol), to send/receive email.
- NNTP (News Network Transfer Protocol), for newsgroups and online discussion.
Tim Berners-Lee was the first to realize the potential of using Hypertext on the internet. Instead of linking dozens of documents on our local machines, we could link billions of documents across the world. He came up with a new protocol, HTTP (HyperText Transfer Protocol), and the rest is history.
All of this to say, links are the “killer feature” of the web. If you're building any sort of significant project, you need to be able to construct multiple pages and link between them.
In these lessons, we're going to dig deeper into how routing works in Next. We'll learn about the clever tricks that Next does to improve performance, see how to move people programmatically from one page to another, and even see how to dynamically generate pages based on the URL.